package cn.electronic.sale.service.imp;

import org.springframework.stereotype.Service;

import com.sun.org.apache.commons.beanutils.BeanUtils;

import cn.electronic.sale.exception.MyException;

import cn.electronic.sale.pojo.Admin;
import cn.electronic.sale.pojo.Goods;
import cn.electronic.sale.service.AdminService;
@Service//将该类定义为一个bean
public class AdminServiceImp extends BasicServiceImp implements AdminService {
	
	public Admin findAdminByNameAndPassword(Admin admin) throws Exception {
		Admin adminTest = adminMapper.findAdminByNameAndPassword(admin);
		if (adminTest==null) {
			throw new MyException("管理员账户和密码不符合！");
		}
	
		return adminTest;
	}
	public int deleteGoods(Integer goodsId) throws Exception {
		// TODO Auto-generated method stub
		
		goodsMapper.deleteByPrimaryKey(goodsId);
		
		return goodsId;
	}
	public int updateGoods(Goods goods) throws Exception {
		// TODO Auto-generated method stub
		goodsMapper.updateByPrimaryKeySelective(goods);
		return 1;
	}

}
